package com.kang.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.kang.service.AuditService;
import com.vonechina.entity.page.ApproveByMeAuditPage;
import com.vonechina.entity.page.MySubmittedAuditPage;

/**
 * 审核记录控制层
 * 
 * @author zs614
 *
 */
@Controller
@RequestMapping("auditRecord")
@SessionAttributes({ "mySubmittedAuditPage", "approveByMeAuditPage" })
public class AuditRecordController extends com.kang.controller.Controller {
	/**
	 * 审核服务层
	 */
	@Resource
	private AuditService auditService;

	/**
	 * 我审核的审核记录
	 * 
	 * @param session
	 * @param model
	 * @param approveByMeAuditPage
	 *            查询参数封装为实体类
	 * @return 返回jsp页面
	 */
	@RequestMapping("approveByMe")
	public String listApproveByMe(HttpSession session, ModelMap model, ApproveByMeAuditPage approveByMeAuditPage) {
		initRight(session);
		approveByMeAuditPage.setUserID(userID);
		model.addAttribute("auditList", auditService.listApproveByMe(approveByMeAuditPage));
		approveByMeAuditPage.setPageUrl("auditRecord/mySubmittedAudit.do");
		model.addAttribute("page", approveByMeAuditPage);
		return "audit/approveByMe";
	}

	/**
	 * 我提交的审核参数
	 * 
	 * @param session
	 * @param model
	 * @param mySubmittedAuditPage
	 *            查询参数封装为实体类
	 * @return
	 */
	@RequestMapping("mySubmittedAudit")
	public String listMySubmittedAudit(HttpSession session, ModelMap model, MySubmittedAuditPage mySubmittedAuditPage) {
		initRight(session);
		mySubmittedAuditPage.setUserID(userID);
		model.addAttribute("auditList", auditService.listMySubmittedAudit(mySubmittedAuditPage));
		mySubmittedAuditPage.setPageUrl("auditRecord/mySubmittedAudit.do");
		model.addAttribute("page", mySubmittedAuditPage);
		return "audit/mySubmittedAudit";
	}
}
